<%--User: 24390 Date: 2021/1/15 Time: 18:53--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" isErrorPage="true" %>
<html>
<%--头部文件--%>
<%@include file="/WEB-INF/include-head.jsp" %>
<link rel="stylesheet" href="/css/pagination.css">
<script src="/jquery/jquery.pagination.js" charset="UTF-8"></script>
<script>
    $(function () {
        initPagination(); // 对分页条进行初始化操作

    });
    function initPagination() {
        var totalRecord = ${requestScope.pageInfo.total}; // 获取总记录数
        var properties = {
            num_edge_entries:2,                              // 边缘页数
            num_display_entries:4,                           // 主体页数
            callback:pageSelectCallback,
            items_per_page:${requestScope.pageInfo.pageSize},// 每页显示的数量
            current_page:${requestScope.pageInfo.pageNum-1}, // 内部源码从0开始，但pageNum从1开始
            prev_text:"上一页",
            next_text:"下一页"
        };
        $("#paginationId").pagination(totalRecord,properties);
    }
    function pageSelectCallback(pageIndex,jQuery) { // 点击页码跳转,pageIndex默认从0开始
        var pageNum = pageIndex+1; // 根据pageIndex计算
        window.location.href = "admin/get/page?pageNum="+pageNum+"&keyword=${param.keyword}" // 前往的页面
        return false; // 超链接默认行为变false不跳转
    }


</script>
<body>

<%--顶部导航文件--%>
<%@include file="/WEB-INF/include-nav.jsp" %>
<div class="container-fluid">
    <div class="row">
        <%--        sidebar--%>
        <%@include file="/WEB-INF/include-sidebar.jsp" %>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="glyphicon glyphicon-th"></i> 数据列表</h3>
                </div>
                <div class="panel-body">
                    <form action="admin/get/page" method="post" class="form-inline" role="form" style="float:left;">
                        <div class="form-group has-feedback">
                            <div class="input-group">
                                <div class="input-group-addon">查询条件</div>
                                <input name="keyword" class="form-control has-success" type="text" placeholder="请输入查询条件">
                            </div>
                        </div>
                        <button type="submit" class="btn btn-warning"><i class="glyphicon glyphicon-search"></i> 查询
                        </button>
                    </form>
                    <button type="button" class="btn btn-danger" style="float:right;margin-left:10px;"><i
                            class=" glyphicon glyphicon-remove"></i> 删除
                    </button>
                    <a href="admin/to/add/page" class="btn btn-primary" style="float:right;"><i class="glyphicon glyphicon-plus"></i> 新增</a>
                    <br>
                    <hr style="clear:both;">
                    <div class="table-responsive">
                        <table class="table  table-bordered">
<%--    表格头--%>
                            <thead>
                            <tr>
                                <th width="30">#</th>
                                <th width="30"><input type="checkbox"></th>
                                <th>账号</th>
                                <th>名称</th>
                                <th>邮箱地址</th>
                                <th width="100">操作</th>
                            </tr>
                            </thead>
<%--    表格体--%>

                            <tbody>

                            <c:if test="${empty requestScope.pageInfo.list}">
                                <tr>
                                    <td colspan="6">抱歉，没有您要查询的数据</td>
                                </tr>
                            </c:if>

                            <c:if test="${not empty requestScope.pageInfo.list}">
                                <c:forEach items="${requestScope.pageInfo.list}" var="admin" varStatus="myStatus">
                                    <tr>
                                        <td>${myStatus.count}</td>
                                        <td><input type="checkbox"></td>
                                        <td>${admin.loginAcct}</td>
                                        <td>${admin.userName}</td>
                                        <td>${admin.email}</td>
                                        <td>
                                            <button type="button" class="btn btn-success btn-xs"><i
                                                    class=" glyphicon glyphicon-check"></i></button>
                                            <a href="admin/to/edit/page?adminId=${admin.id}&pageNum=${requestScope.pageInfo.pageNum}" class="btn btn-primary btn-xs"><i
                                                    class=" glyphicon glyphicon-pencil"></i></a>
                                            <a href="admin/remove/${admin.id}/${requestScope.pageInfo.pageNum}" class="btn btn-danger btn-xs" id="only_del"><i
                                                    class=" glyphicon glyphicon-remove"></i></a>
                                        </td>
                                    </tr>

                                </c:forEach>
                            </c:if>


                            </tbody>
<%--    表格脚--%>
<%--<tfoot>--%>
<%--<tr>--%>
<%--    <td colspan="6" align="center">--%>
<%--        <ul class="pagination">--%>
<%--            <li class="disabled"><a href="#">上一页</a></li>--%>
<%--            <li class="active"><a href="#">1 <span class="sr-only">(current)</span></a></li>--%>
<%--            <li><a href="#">2</a></li>--%>
<%--            <li><a href="#">3</a></li>--%>
<%--            <li><a href="#">4</a></li>--%>
<%--            <li><a href="#">5</a></li>--%>
<%--            <li><a href="#">下一页</a></li>--%>
<%--        </ul>--%>
<%--    </td>--%>
<%--</tr>--%>

<%--</tfoot>--%>
<tfoot>
<tr>
    <td colspan="6" align="center">
        <div id="paginationId" class="pagination"></div>
    </td>
</tr>
</tfoot>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

</body>
</html>


